<template>
     <ui-dialog 
     :visible.sync="dialogVisible"
     :show-close="showClose"
   
     :title="title"
     @close="close"
     >  
         <div>
             <template>
                 <span>
                     客户名称
                 </span>

                  <ui-input  placeholder="请输入客户名称"> 
                            
                  </ui-input>
                   <ui-button>
                    查询 
                   </ui-button>
                   <ui-button>
                    重置
                   </ui-button>
             </template>
         </div>  

        <ui-table 
            :data="tableData"
            border
            ref="uiTable"
            size="medium"
            fit 
            :btnFixed="btnFixed"
        >
            <ui-table-column width="55"  fixed>
                <template slot-scope="scope">
                    <ui-radio v-model="currentFactor" :label="scope.row" @change="clickChange" >{{ "" }}</ui-radio>
                </template>
            </ui-table-column>

            <template  v-for="(item ,index) in columns">
                <ui-table-column
                :column-key="index + ''"
                :type="item.type"
                :prop="item.prop"
                :label="item.label"
                :fixed="item.fixed"
                :key="index"
                :width="item.width"
                align="center"
                :formatter="item.formatter"
                >
                </ui-table-column>
            </template>  

        </ui-table>       

        <div style="text-align: center;">
            <ui-button class="primary-btn" @click="handleCancel" icon="ui-icon-search">取消</ui-button>
            <ui-button class="default-btn" @click="confirmdata" icon="ui-icon-refresh-right">确定</ui-button>
        </div>
     </ui-dialog>     
</template>
<script>
  export default{
    name: 'comp-dialogselect',
    
    props:{
        dialogVisible:{
            type: Boolean,
            default: false
        },
        btnFixed: {
            type: [Boolean, String],
            default: false
        },
        title:{
            type: String,
            default: function() {
                return [];
            },
        },
        
        tableData: {
            type: Array,
            default: function() {
                return [];
            },
        },

        columns: {
            type: Array,
            default: function() {
                return [];
            },
        },

    },
    data() {
    return {
       
        selectdata:null,
        showClose:false,
        currentFactor:''
    };
    },

    watch: {
      
    },

    mounted(){
        console.log(this.dialogVisible);
    },
    methods:{
        close() {
        this.show = false;
        this.$emit('close');
        },
        cancleback(){
            this.show=false;
           
        },
        confirmdata(){
           
              
                this.$emit('selectdata',this.selectdata)
                this.dialogVisible=false;
                this.$emit('cancel',this.dialogVisible)
            
        },
        clickChange(row){
            console.log(row)
            this.selectdata=row;
        },

        handleCancel() {
             this.dialogVisible=false;
             this.$emit('cancel',this.dialogVisible)
            },
           
    },

    created(){
    
    }

  }
</script>